package cn.micai.base.io;

import java.io.File;
import java.text.SimpleDateFormat;

/**
 * 描述：How to get last modified date of file in java
 * <p>
 *
 * @author: 赵新国
 * @date: 2018/6/7 11:55
 */
public class GetLastModifiedTimeOfFileMain {

    public static void main(String [] args) {

        System.out.println("--------------------");
        // Read the file
        File file = new File("D://BaiduNetdiskDownload/《九年双11：互联网技术超级工程》.pdf");

        System.out.println("Time inmilliseconds: " + file.lastModified());

        SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dateFormat=sdf.format(file.lastModified());

        System.out.println("Time in date format: "+dateFormat);
        System.out.println("-----------------");

    }
}
